import 'package:x_core/net/base_entity.dart';
import 'package:x_core/net/json/base/json_convert_content.dart';

BaseEntity<T> $BaseEntityFromJson<T>(Map<String, dynamic> json) {
  final BaseEntity<T> baseEntity = BaseEntity<T>();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    baseEntity.code = code;
  }
  final String? message = jsonConvert.convert<String>(json['message']);
  if (message != null) {
    baseEntity.message = message;
  }
  // final T? data = jsonConvert.convert<T>(json['data']);
  if (json['data'] != null) {
    baseEntity.data = json['data'];
  }
  return baseEntity;
}

Map<String, dynamic> $BaseEntityToJson(BaseEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['message'] = entity.message;
  data['data'] = entity.data?.toJson();
  return data;
}
